package finalize;

import java.io.FileWriter;
import java.io.IOException;

public class FinalMan {
	
	private FileWriter fw = null;
	
	public FinalMan(String fileName) throws IOException {
		this.fw = new FileWriter(fileName);
	}
	
	public void writeData(String str) throws IOException {
		this.fw.write(str);
	}
	
	protected void finalize() throws Throwable, IOException {
		if (this.fw != null) {
			this.fw.close();
		}
		System.out.println("finalize()의 파일 닫기");
		super.finalize();
	}
	
}
